<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<chiptrack:checkLogon sourcePage="/salesReport.do?action=missedorderreport" />
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.GregorianCalendar" %>
<%@ page import="java.util.Date" %>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>


<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<script>
var dateElement = "";
function openCalendar(dateValue)
{
	dateElement = dateValue;
  	newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
  	newWindow.moveTo(550,180);
  	newWindow.focus();
    }
	function assignDate(passedValue)
    {   
	dateElement.value=passedValue;
	window.focus();
    }

function dateRange(){


var period="";
var cat="";

var d = new Date();
		var day = d.getDate();
		var month = d.getMonth()+1;
		var year = d.getFullYear();
		var hour = d.getHours();
		var min = d.getMinutes();
		var sec = d.getSeconds();
		
		var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;

for (counter = 0; counter < backlogReport.category.length; counter++)
{
if (backlogReport.category[counter].checked){
	cat = backlogReport.category[counter].value;
	}
}

for (counter = 0; counter < backlogReport.periodically.length; counter++)
{
if (backlogReport.periodically[counter].checked){
	period = backlogReport.periodically[counter].value;
	}
}

if (document.backlogReport.datefrom.value =='')
	document.backlogReport.prompt0.value = '0';
else 
	document.backlogReport.prompt0.value = document.backlogReport.datefrom.value;

if (document.backlogReport.dateto.value =='')
	document.backlogReport.prompt1.value = '0';
else 
	document.backlogReport.prompt1.value = document.backlogReport.dateto.value;

if (document.backlogReport.customers.value =='')
	document.backlogReport.prompt2.value = '0';
else 
	document.backlogReport.prompt2.value = document.backlogReport.customers.value;

if (document.backlogReport.products.value =='')
	document.backlogReport.prompt3.value = '0';
else 
	document.backlogReport.prompt3.value = document.backlogReport.products.value;

if (document.backlogReport.regions.value =='')
	document.backlogReport.prompt4.value = '0';
else 
	document.backlogReport.prompt4.value = document.backlogReport.regions.value;

if (document.backlogReport.repoffices.value =='')
	document.backlogReport.prompt5.value = '0';
else 
	document.backlogReport.prompt5.value = document.backlogReport.repoffices.value;

if (document.backlogReport.endusers.value =='')
	document.backlogReport.prompt6.value = '0';
else 
	document.backlogReport.prompt6.value = document.backlogReport.endusers.value;

if (document.backlogReport.spersons.value =='')
	document.backlogReport.prompt7.value = '0';
else 
	document.backlogReport.prompt7.value = document.backlogReport.spersons.value;

document.backlogReport.prompt8.value = defaultPrompt;

if ( cat == "scheduleDate" && period=="byWeek")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_scheduledate_week.rpt";
	document.backlogReport.submit();
}

else if ( cat == "scheduleDate" && period=="byMonth")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_scheduledate_month.rpt";
	document.backlogReport.submit();
}

else if ( cat == "scheduleDate" && period=="byQuarter")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_scheduledate_quarter.rpt";
	document.backlogReport.submit();
}

else if ( cat == "reqshipDate" && period=="byWeek")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_requestdate_week.rpt";
	document.backlogReport.submit();
}

else if ( cat == "reqshipDate" && period=="byMonth")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_requestdate_month.rpt";
	document.backlogReport.submit();
}

else if ( cat == "reqshipDate" && period=="byQuarter")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_requestdate_quarter.rpt";
	document.backlogReport.submit();
}
else if ( cat == "reviseshipDate" && period=="byWeek")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_revisedshippdate_week.rpt";
	document.backlogReport.submit();
}

else if ( cat == "reviseshipDate" && period=="byMonth")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_revisedshippdate_month.rpt";
	document.backlogReport.submit();
}

else if ( cat == "reviseshipDate" && period=="byQuarter")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_revisedshippdate_quarter.rpt";
	document.backlogReport.submit();
}

else if ( cat == "missedorderhistory" && period=="byWeek")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_history_week.rpt";
	document.backlogReport.submit();
}

else if ( cat == "missedorderhistory" && period=="byMonth")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_history_month.rpt";
	document.backlogReport.submit();
}

else if ( cat == "missedorderhistory" && period=="byQuarter")
{
	document.backlogReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/Missed_Orders/SALE_missed_history_quarter.rpt";
	document.backlogReport.submit();
}
}
function initLoad()
{
    <%!
      String fromDate = null;
      String toDate = null;
    %>
    <%

        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
        Calendar calendar = Calendar.getInstance();
        GregorianCalendar gc = new GregorianCalendar(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE));
        gc.add(GregorianCalendar.YEAR, -1);
        Date d = gc.getTime();
        fromDate = sdf.format(d);

        SimpleDateFormat sdf1 = new SimpleDateFormat("MM/dd/yyyy");
        Calendar calendar1 = Calendar.getInstance();
        GregorianCalendar gc1 = new GregorianCalendar(calendar1.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE));
        gc1.add(GregorianCalendar.DATE, 1);
        Date d1 = gc1.getTime();
        toDate = sdf1.format(d1);
    %>
    document.getElementById("datefrom").value = "<%=fromDate%>";
    document.getElementById("dateto").value = "<%=toDate%>";
}

</script>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" onload="initLoad();">

<form name =backlogReport method="post">

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<input type="hidden" name="prompt0">
<input type="hidden" name="prompt1">
<input type="hidden" name="prompt2">
<input type="hidden" name="prompt3">
<input type="hidden" name="prompt4">
<input type="hidden" name="prompt5">
<input type="hidden" name="prompt6">
<input type="hidden" name="prompt7">
<input type="hidden" name="prompt8">

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/sales/sales_report_menu.jsp" %>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->



<center><span class="NArialW">Missed Order Reports</span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>


  <table border="0" width="90%" align=right>
    <tr>
      <td width="15%"><font class="NArialL">From-Date</font></td>
      <td width="20%"><font class="NArialL">
  <input type="text" name="datefrom" size="20" class="txfield"></font>&nbsp;
  <a href="javascript:openCalendar(document.backlogReport.datefrom)">
  <img border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=15 width=15></a></td>
      	<td width="5%">&nbsp;</td>
      <td width="15%"><font class="NArialL">To-Date</font></td>
      <td width="20%"><font class="NArialL">
      	<input  type="text" name="dateto" size="20" class="txfield"></font>&nbsp;
    <a href="javascript:openCalendar(document.backlogReport.dateto)">
	<img border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=15 width=15></a></td>
		<td width="15%">&nbsp;</td>
    </tr>
    <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
	<tr>
      <td width="15%"><font class="NArialL">Customer</font></td>
      <td width="20%"><font class="NArialL">
      	<select size="1" name="customers" class="txfield">
       <option value="0">All Customers</option>
    <logic:iterate id="customerSelectList" name="customerSelectList">
	<logic:notEqual name="customerSelectList" value="null">
 <option value = <bean:write name="customerSelectList" property="customerId"/>>
 <bean:write name="customerSelectList" property="customerName"/>
 </option>
 </logic:notEqual>
 </logic:iterate> 
      </select></td>
      	<td width="5%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Product</font></td>
      <td width="20%"><font class="NArialL">
	  <select size="1" name="products" class="txfield">
        <option value="0">All Products</option>
    <logic:iterate id="mktgPartNumberSelectList" name="mktgPartNumberSelectList">
	<logic:notEqual name="mktgPartNumberSelectList" value="null">
 <option value = "<bean:write name="mktgPartNumberSelectList" property="productId"/>">
 <bean:write name="mktgPartNumberSelectList" property="marketingPartNo"/>
 </option>
 </logic:notEqual>
 </logic:iterate> 
      </select></td>
		<td width="15%">&nbsp;</td>
    </tr>
	<tr>
      <td width="15%"><font class="NArialL">Region</font></td>
      <td width="20%"><font class="NArialL">
      	<select size="1" name="regions" class="txfield">
        <option value="">All Regions</option>
    <logic:iterate id="regionList" name="regionList">
	<logic:notEqual name="regionList" value="null">
 <option value = "<bean:write name="regionList" />">
 <bean:write name="regionList"/>
 </option>
 </logic:notEqual>
 </logic:iterate> 
      </select></td>
      	<td width="5%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Regional Rep</font></td>
      <td width="20%"><font class="NArialL"><select size="1" name="repoffices" class="txfield">
       <option value="">All Regional Reps</option>
    <logic:iterate id="repOfficeList" name="repOfficeList">
	<logic:notEqual name="repOfficeList" value="null">
 <option value = "<bean:write name="repOfficeList" />">
 <bean:write name="repOfficeList"/>
 </option>
 </logic:notEqual>
 </logic:iterate> 
      </select></td>
		<td width="15%">&nbsp;</td>
    </tr>
	<tr>
      <td width="15%"><font class="NArialL"><bean:message key="label.sales.endUser"/></font></td>
      <td width="20%"><font class="NArialL">
      	<select size="1" name="endusers" class="txfield">
        <option value="">All <bean:message key="label.sales.endUser"/>s</option>
    <logic:iterate id="endUserList" name="endUserList">
	<logic:notEqual name="endUserList" value="null">
 <option value = "<bean:write name="endUserList" />">
 <bean:write name="endUserList"/>
 </option>
 </logic:notEqual>
 </logic:iterate> 
      </select></td>
	<td width="5%">&nbsp;</td>
    <td width="15%"><font class="NArialL">Sales Person Name</font></td>
    <td width="20%"><font class="NArialL"><select size="1" name="spersons" class="txfield">
			<option value="">All Sales Persons</option>
    <logic:iterate id="salesPersonList" name="salesPersonList">
	<logic:notEqual name="salesPersonList" value="null">
 <option value = "<bean:write name="salesPersonList" />">
 <bean:write name="salesPersonList"/>
 </option>
 </logic:notEqual>
 </logic:iterate> 
		  </select></td>
	<td width="15%">&nbsp;</td>
    </tr>
    <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    <tr><td colspan=5>
    	<input type="radio" name="category" value="scheduleDate" checked>
    		<font class="NArialL">By Schedule Date </font>&nbsp;&nbsp;&nbsp;&nbsp;
    	<input type="radio" name="category" value="reqshipDate">
    		<font class="NArialL">By Requested Dock Date</font>
    	&nbsp;&nbsp;&nbsp;&nbsp; <br>
    	<!--
		<input type="radio" name="category" value="reviseshipDate">
    		<font class="NArialL">By Revised Ship Date</font>
			&nbsp;&nbsp;&nbsp;&nbsp; 
    	<input type="radio" name="category" value="missedorderhistory">
    		<font class="NArialL">Missed Order History</font>
		-->

    </td></tr>
    <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    <tr><td colspan=5>
	    	<input type="radio" name="periodically" value="byWeek" checked>
	    		<font class="NArialL">By Week </font>&nbsp;&nbsp;&nbsp;&nbsp;
	    	<input type="radio" name="periodically" value="byMonth">
	    		<font class="NArialL">By Month</font>&nbsp;&nbsp;&nbsp;&nbsp;
	    	<input type="radio" name="periodically" value="byQuarter">
	    		<font class="NArialL">By Quarter</font>
    </td></tr>
    <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
	<tr>
      <td colspan=5 align=center><a href="javascript:dateRange()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17"></a>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17"></td>
    </tr>
  </table>

<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here --> 
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</form>
</BODY>
</HTML>
 